<template>
  <div class="star-course">
    <div class="heading">
      <div class="title">明星课程</div>
      <div class="info">
        优选好课等你来
        <van-icon name="arrow" />
      </div>
    </div>

    <div class="content">
      <div class="reason">
        <div class="reason-tag">
          <span>
            <div>筛选</div>
            <div>方法</div>
          </span>
        </div>
        <div class="delta"></div>

        <div class="info">{{ reasonInfo.content }}</div>
      </div>

      <div class="article">
        <row-image
          v-for="item in articles"
          :key="item.id"
          :style="{ margin: 0 }"
          :border="false"
          :title="item.title"
          :desc="item.type"
          :cover="item.cover"
          :star="Number(item.star)"
          :read="item.read"
        />
      </div>

      <div class="more">
        <div class="button">查看更多</div>
      </div>
    </div>
  </div>
</template>

<script>
import Vue from 'vue'
import { Icon } from 'vant'
import RowImage from '@/components/Product/RowImage'

Vue.use(Icon)

export default {
  components: {
    RowImage
  },

  data() {
    return {
      curr: -1,
      reasonInfo: {
        content: '好的课程，将使你事半功倍，由专业人士联袂打造，精挑细选出的精品职业技能和发展课。'
      },
      articles: [
        {
          id: 0,
          cover: '',
          title: 'python量化交易入门',
          read: '3.8',
          star: '4',
          type: 'Elan巴克莱资本 | 500强'
        },
        {
          id: 1,
          cover: '',
          title: 'python量化交易入门',
          read: '3.8',
          star: '4',
          type: 'Elan巴克莱资本 | 500强'
        }
      ]
    }
  },

  methods: {
    onSelect(e) {
      const { id } = e
      this.curr = this.curr === id ? -1 : id
    }
  }
}
</script>

<style lang="less" scoped>
.star-course {
  .heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 17px;

    .title {
      font-size: 18px;
      color: #222222;
      font-weight: 500;
    }

    .info {
      font-size: 13px;
      color: #999999;
      display: flex;
      align-items: center;
    }
  }

  .content {
    background-color: #ffffff;
    margin: 0 17px;
    margin-top: 15px;
    padding: 17px 13px;
    border-radius: 5px;
    box-shadow: 0 0 15px 0 rgba(0, 0, 0, 0.1);

    .reason {
      background-color: #eef2f9;
      border-radius: 5px;
      align-items: center;
      display: flex;
      position: relative;
      padding: 18.5px 20px;
      justify-content: flex-end;

      .reason-tag {
        position: absolute;
        left: 13.5px;
        top: -3px;
        width: 35px;
        height: 52.5px;
        background-color: #ec5431;
        border-radius: 2px;
        display: flex;
        justify-content: center;
        text-align: center;
        color: #ffffff;

        span {
          font-size: 10px;
          margin-top: 5px;
        }
      }

      .delta {
        position: absolute;
        left: 15px;
        top: 43.5px;
        width: 0;
        height: 0;
        border-left: 17px solid transparent;
        border-right: 17px solid transparent;
        border-bottom: 6px solid #eef2f9;
      }

      .info {
        line-height: 16.5px;
        font-size: 12px;
        color: #999999;
        width: 228px;
      }
    }

    .more {
      display: flex;
      justify-content: center;
      margin-top: 21.5px;

      .button {
        padding: 5px 22px;
        border-radius: 5px;
        border: 1px solid #3478f6;
        color: #3478f6;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 14px;
      }
    }
  }
}
</style>